# -*- coding: utf-8 -*-

from src.db.insert_ucloud_db import ReadLogList
from src.db.delete_ucloud_db import DeleteFile
import threading

from twisted.internet import reactor
from src.db.ucloud_db import truncate_table


if __name__ == "__main__":
    truncate_table()

    reactor.callWhenRunning(ReadLogList().get_next_page)

    def delete():
        reactor.callWhenRunning(DeleteFile().delete_file)
    time_thread = threading.Timer(60*60*2, delete)  # 延迟2小时
    time_thread.start()

    reactor.run()
